using System;
using SdlDotNet.Graphics;

namespace Core.Views
{
    public class GameView : View
    {
        private Surface backBuffer;
        public Surface BackBuffer
        {
            get { return backBuffer; }
        }

        private Surface display;
        
        public Surface Display
        {
            get { return display; }
            set
            {
                backBuffer = new Surface(value);
                display = value;
            }
        }

        public GameView(Controller controller) : base(controller)
        {
            backBuffer = new Surface(0, 0);
        }

        public override void Update()
        {
            if (Display == null)
                throw new MissingDisplaySurfaceException();

            display.Blit(backBuffer);
        }
    }

    public class MissingDisplaySurfaceException : Exception
    {
    }
}
